<template>

      <div class="table_1">
      <el-form :data="dataForm">
       
      
      <div class="table_title td_color">抵押物信息栏</div>
      <table class="table_wrap">
        <tbody>
          <tr>
            <td class="table_td td_color">
                抵押物用途
            </td>
            <td class="table_td">
              <DicSelect dictType = "抵押物用途" :dictValue="dataForm.purpose" v-on:dictValue="dataForm.purpose = $event"/>
            </td>
            <td class="table_td td_color">
                共有情况
            </td>
            <td class="table_td">
              <DicSelect dictType = "共有情况" :dictValue="dataForm.ownedSituation" v-on:dictValue="dataForm.ownedSituation = $event"/>
            </td>
            <td class="table_td td_color">
                  获取方式
            </td>
            <td class="table_td">
              <DicSelect dictType = "获取方式" :dictValue="dataForm.accessType" v-on:dictValue="dataForm.accessType = $event"/>
            </td>
            <td class="table_td td_color">
                 小区名称
            </td>
            <td colspan="3" class="table_td">
            <el-input  v-model="dataForm.villageName"/> 
            </td>
            <td class="table_td td_color">
                楼幢号
            </td>
            <td class="table_td">
            <el-input  v-model="dataForm.buildNo"/> 
            </td>
          </tr>
          <!--第二行-->
          <tr>
            <td class="table_td td_color">
                总楼层数
            </td>
            <td class="table_td">
            <el-input  v-model="dataForm.floorsTotal"/> 
            </td>
            <td class="table_td td_color">
                门牌号
            </td>
            <td class="table_td">
            <el-input  v-model="dataForm.doorNo"/> 
            </td>
            <td class="table_td td_color">
                抵押物现状
            </td>
            <td class="table_td">
              <DicSelect dictType = "抵押物现状" :dictValue="dataForm.currentSituation" v-on:dictValue="dataForm.currentSituation = $event"/>
            </td>
            <td class="table_td td_color">
                 房龄  
            </td>
            <td class="table_td">
            <el-input  v-model="dataForm.houseAge"/> 
            </td>
            <td class="table_td td_color">
                 产权人
            </td>
            <td class="table_td">
            <el-input  v-model="dataForm.propertyOwner"/> 
            </td>
            <td class="table_td td_color">
                权利(土地)性质
            </td>
            <td class="table_td">
              <DicSelect dictType = "土地权利性质" :dictValue="dataForm.landNature" v-on:dictValue="dataForm.landNature = $event"/>
            </td>
          </tr>
          <!--第三行-->
          <tr>
            <td class="table_td td_color">
                房屋用途
            </td>
            <td class="table_td">
              <DicSelect dictType = "房屋用途" :dictValue="dataForm.houseUse" v-on:dictValue="dataForm.houseUse = $event"/>
            </td>
            <td class="table_td td_color">
                土地使用期限
            </td>
            <td class="table_td">
            <el-input  v-model="dataForm.durationLandUse"/> 
            </td>
            <td class="table_td td_color">
                建筑面积
            </td>
            <td class="table_td">
            <el-input  v-model="dataForm.areaTotal"/> 
            </td>
            <td class="table_td td_color">
                 楼层数  
            </td>
            <td class="table_td">
            <el-input  v-model="dataForm.floors"/> 
            </td>
            <td class="table_td td_color">
                 不动产单元号
            </td>
            <td colspan="3" class="table_td">
            <el-input  v-model="dataForm.unitNumber"/> 
            </td>
          </tr>
          <!--第四行-->
          <tr>
            <td class="table_td td_color">
                建筑类型
            </td>
            <td class="table_td">
              <DicSelect dictType = "住宅类型" :dictValue="dataForm.houseType" v-on:dictValue="dataForm.houseType = $event"/>
            </td>
            <td class="table_td td_color">
                房屋朝向
            </td>
            <td class="table_td">
              <DicSelect dictType = "房屋朝向" :dictValue="dataForm.buildingHead" v-on:dictValue="dataForm.buildingHead = $event"/>
            </td>
            <td class="table_td td_color">
                 房屋地址  
            </td>
            <td colspan="3" class="table_td">
             <el-cascader v-model="addressRegionValues" :options="regionList" clearable  placeholder="请选择地址" 
             :props="{ expandTrigger: 'hover' }" style="width:100%;"></el-cascader>
            </td>
            <td class="table_td td_color">
              房屋详细地址
            </td>
            <td colspan="3"  class="table_td">
              <el-input  v-model="dataForm.addressDetail"/> 
            </td>
          </tr>
          <!--第五行-->
          <tr>
            <td class="table_td td_color">
                产证号
            </td>
            <td colspan="3" class="table_td">
            <el-input  v-model="dataForm.licenseNo"/> 
            </td>
            <td class="table_td td_color" >
                现使用情况
            </td>
            <td colspan="1" class="table_td">
              <DicSelect dictType = "现使用情况" :dictValue="dataForm.nowUsage" v-on:dictValue="dataForm.nowUsage = $event"/>
            </td>
<!--             <td class="table_td td_color" colspan="2">
                权利(土地)性质
            </td>
            <td colspan="1" class="table_td">
             <DicSelect dictType = "土地权利性质" :dictValue="dataForm.landNature" v-on:dictValue="dataForm.houseDTO.landNature = $event"/>
            </td> -->
            <td class="table_td td_color" colspan="2">
                权利(房产)性质
            </td>
            <td colspan="1" class="table_td">
             <el-input v-model="dataForm.houseNature" maxlength="10"/>
            </td>
          </tr>

        </tbody>
      </table>

  <!--第二个表格-->
        <div class="table_title td_color" style="margin-top:30px;">现房抵押情况</div>
         <table class="table_wrap">
        <tbody>
          <!--第二行-->
          <tr v-for="item in dataForm.houseHistries">
            <td class="table_td td_color">
                {{item.title}}
            </td>
            <td colspan="2"  class="table_td">
            <el-input  v-model="item.borrowerOrg"/> 
            </td>
            <td class="table_td td_color">
                借款金额
            </td>
            <td class="table_td">
            <el-input  v-model="item.money"/> 
            </td>
            <td class="table_td td_color">
                期限
            </td>
            <td class="table_td">
            <el-input v-model="item.deadline"/> 
            </td>
            <td class="table_td td_color">
                 剩余本金
            </td>
            <td class="table_td">
            <el-input type="number" v-model="item.remainCapital"/> 
            </td>
            <td class="table_td td_color">
                还款方式
            </td>
            <td colspan="2" class="table_td">
            <el-input v-model="item.repayWay"/> 
            </td>
          </tr>
        

        </tbody>
      </table>
      </el-form>
      
      <div class="table_1" v-if="showEvaluation" style="margin-top:30px;">
        <div class="table_title td_color">房屋评估信息</div>
         <table class="table_wrap">
        <tbody>
          <!--第一行-->
          <tr>
            <td class="table_td td_color">
               世联评估(万元)
            </td>
            <td colspan="2"  class="table_td">
               <el-input v-model="editForm.slEvaluationPrice"  @change="value => inputChange(value,'slEvaluationPrice')" @input="numValid('slEvaluationPrice')" placeholder="评估后自动填充房产价格">
                  <template slot="append"><el-button @click="clickGet" v-loading.fullscreen.lock="fullscreenLoading">评估</el-button></template>
                </el-input>
            </td>
            <td class="table_td " colspan="8">
                
            </td>
          </tr>
          <!-- 第二行 -->
          <tr>
            <td class="table_td td_color">
              蓝海APP(万元)
            </td>
            <td colspan="2"  class="table_td">
               <el-input v-model="editForm.lanhaiEvaluationPrice" @change="value => inputChange(value,'lanhaiRate')" @input="numValid('lanhaiEvaluationPrice')" placeholder="请输入评估价格">
                  <template slot="append">同比世联 {{(editForm.lanhaiRate) && editForm.lanhaiEvaluationPrice != ''?editForm.lanhaiRate < 0?editForm.lanhaiRate.toString().replace(/-/g,"")+'%':editForm.lanhaiRate+'%':editForm.lanhaiRate == 0?"0%":'-'}} <span v-if="editForm.lanhaiRate > 0" style="color:#ff0000;">↑</span> <span v-if="editForm.lanhaiRate < 0" style="color:#00b050;">↓</span></template>
                </el-input>
            </td>
            <td class="table_td td_color">
              国厚评估(万元)
            </td>
            <td colspan="2"  class="table_td">
               <el-input v-model="editForm.guohouEvaluationPrice" @change="value => inputChange(value,'guohouRate')"  @input="numValid('guohouEvaluationPrice')" placeholder="请输入评估价格">
                  <template slot="append">同比世联 {{(editForm.guohouRate) && editForm.guohouEvaluationPrice != ''?editForm.guohouRate < 0?editForm.guohouRate.toString().replace(/-/g,"")+'%':editForm.guohouRate+'%':editForm.guohouRate == 0?"0%":'-'}} <span v-if="editForm.guohouRate > 0" style="color:#ff0000;">↑</span> <span v-if="editForm.guohouRate < 0" style="color:#00b050;">↓</span></template>
                </el-input>
            </td>
            <td class="table_td td_color">
              小亿评估(万元)
            </td>
            <td colspan="2"  class="table_td">
               <el-input v-model="editForm.xiaoyiEvaluationPrice" @change="value => inputChange(value,'xiaoyiRate')" @input="numValid('xiaoyiEvaluationPrice')" placeholder="请输入评估价格">
                  <template slot="append">同比世联 {{(editForm.xiaoyiRate) && editForm.xiaoyiEvaluationPrice != ''?editForm.xiaoyiRate < 0 ? editForm.xiaoyiRate.toString().replace(/-/g,"")+'%':editForm.xiaoyiRate+'%':editForm.xiaoyiRate == 0?"0%":'-'}} <span v-if="editForm.xiaoyiRate > 0" style="color:#ff0000;">↑</span> <span v-if="editForm.xiaoyiRate < 0" style="color:#00b050;">↓</span></template>
                </el-input>
            </td>
          </tr>
          <!-- 第三行 -->
          <tr>
            <td class="table_td td_color">
              亚联财评估(万元)
            </td>
            <td colspan="2"  class="table_td">
               <el-input v-model="editForm.yaliancaiEvaluationPrice" @change="value => inputChange(value,'yaliancaiRate')" @input="numValid('yaliancaiEvaluationPrice')" placeholder="请输入评估价格">
                  <template slot="append">同比世联 {{(editForm.yaliancaiRate) && editForm.yaliancaiEvaluationPrice != ''?editForm.yaliancaiRate<0 ? editForm.yaliancaiRate.toString().replace(/-/g,"")+'%':editForm.yaliancaiRate+'%':editForm.yaliancaiRate == 0?"0%":'-'}} <span v-if="editForm.yaliancaiRate > 0" style="color:#ff0000;">↑</span> <span v-if="editForm.yaliancaiRate < 0" style="color:#00b050;">↓</span></template>
                </el-input>
            </td>
            <td class="table_td td_color">
              中关村评估(万元)
            </td>
            <td colspan="2"  class="table_td">
               <el-input v-model="editForm.zhongguancunEvaluationPrice" @change="value => inputChange(value,'zhongguancunRate')" @input="numValid('zhongguancunEvaluationPrice')" placeholder="请输入评估价格">
                  <template slot="append">同比世联 {{(editForm.zhongguancunRate) && editForm.zhongguancunEvaluationPrice != ''?editForm.zhongguancunRate<0 ? editForm.zhongguancunRate.toString().replace(/-/g,"")+'%':editForm.zhongguancunRate+'%':editForm.zhongguancunRate == 0?"0%":'-'}} <span v-if="editForm.zhongguancunRate > 0" style="color:#ff0000;">↑</span> <span v-if="editForm.zhongguancunRate < 0" style="color:#00b050;">↓</span></template>
                </el-input>
            </td>
            <td class="table_td td_color">
              其他机构(万元)
            </td>
            <td colspan="2"  class="table_td">
               <el-input v-model="editForm.otherEvaluationPrice" @change="value => inputChange(value,'otherRate')" @input="numValid('otherEvaluationPrice')" placeholder="请输入评估价格">
                  <template slot="append">同比世联 {{(editForm.otherRate) && editForm.otherEvaluationPrice != ''?editForm.otherRate < 0 ? editForm.otherRate.toString().replace(/-/g,"")+'%':editForm.otherRate+'%':editForm.otherRate == 0?"0%":'-'}} <span v-if="editForm.otherRate > 0" style="color:#ff0000;">↑</span> <span v-if="editForm.otherRate < 0" style="color:#00b050;">↓</span></template>
                </el-input>
            </td>
          </tr>
        <!-- 第四行 -->
        <tr>
           <td class="table_td td_color">
              房产评估总价(终审)
            </td>
            <td colspan="2"  class="table_td">
               <el-input v-model="editForm.finalReviewEvaluationPrice" placeholder="请输入评估价格" @input="numValid('finalReviewEvaluationPrice')" >
                  <template slot="append">万元</template>
                </el-input>
            </td>
            <td class="table_td td_color">
              房产剩余价值
            </td>
            <td colspan="2"  class="table_td">
               <el-input v-model="dataForm.remainValue" placeholder="请输入评估价格" @input="numValiddata('remainValue')" >
                  <template slot="append">万元</template>
                </el-input>
            </td>
            <td class="table_td td_color">
              
            </td>
            <td colspan="2"  class="table_td">
               
            </td>
          </tr>
        </tbody>
      </table>
        <!-- <el-card class="box-card" shadow="never">
         <el-form ref="editForm" :inline="true" :model="editForm" status-icon label-position="right" label-width="160px" >
        
                  <el-form-item label="房产评估核查" prop="slEvaluationPrice">
                      <el-cascader
                      v-model="regionValues"
                      :options="regionList"
                      clearable 
                      placeholder="请选择房产所在区域"
                      :props="{ expandTrigger: 'hover' }" 
                      style="width:100%;"></el-cascader>
                   
                  </el-form-item>
                   <el-form-item label="折扣率" prop="rate" >
                    <el-input type="number"  v-model="editForm.rate"  placeholder="请输入折扣率">
                      <template slot="append">%</template>
                    </el-input>
                  </el-form-item>
                   <el-form-item label="房产详细地址" prop="rate" >
                    <el-input v-model="editForm.address"  placeholder="请输入房产详细地址">
                    </el-input>
                  </el-form-item>
                   <el-form-item label="房产价格（万元）" prop="rate" >
                    <el-input v-model="editForm.slEvaluationPrice" placeholder="评估后自动填充房产价格">
                       <template slot="append"><el-button @click="clickGet" v-loading.fullscreen.lock="fullscreenLoading">评估</el-button></template>
                    </el-input>
                  </el-form-item>
              
          
           </el-form>
      </el-card> -->
      
     
      <div class="table_1" style="margin-top:30px;">
        <div class="table_title td_color">调查情况说明</div>
         <table class="table_wrap">
          <tbody>
            <tr>
              <td class="table_td td_color">
                <el-input type="textarea" placeholder="请输入调查情况说明"
                  maxlength="200"
                  rows="5"
                  show-word-limit
                  v-model="dataForm.investigatorDesc"
                />
              </td>
            </tr>
          </tbody>
         </table>
      </div>
      <!---->
       <div style="width:400px;margin-top:5%;margin-left:40%;">
              <!-- <el-button  type="primary" @click="restForm" v-permission="'system:check-opinion:edit'" style="width:150px;height:40px;">清空</el-button> -->
              <el-button  v-if="operationLook === undefined"  v-permission="'system:house:edit'"  type="warning" @click="createData" style="width:150px;height:40px;">保存</el-button>
              <el-button   type="primary" @click="exportData" style="width:150px;height:40px;">打印</el-button>
          </div>
      </div>
    </div>


    
 

</template>

<script>
import { findByProjectId,updateHouseRate,houseEvaluation,updateHouse,exportHouse } from '@/api/house'
import { taskSupplementStatus } from '@/api/project'
import { listRegion } from '@/api/region'
import DicSelect from '@/components/select'
  export default {
    components: { DicSelect },
      // 接受父组件的值
      props: {
        changeValue: undefined,
        projectId: undefined,
        operationLook: undefined,
        taskId: undefined,
        projectStatus: undefined
    },
    data () {
      return {
         addressRegionValues: [],
         regionValues: [],
         headData: "",
         dataForm:{},
         editForm:{},
         address: undefined,
         regionList:[],
         showEvaluation: true,
         fullscreenLoading: false
      }
    },
    created(){
      this.findByProjectId()
      this.getRegionList()
      if( this.projectStatus === 18){
        this.taskSupplementStatus()
      }
    },
    methods: {
       findByProjectId() {
      this.listLoading = true
      findByProjectId({projectId:this.projectId})
        .then(response => {
          if(response.data != undefined ) {
            this.addressRegionValues = []
            this.dataForm = response.data[0]
            this.addressRegionValues.push(this.dataForm.provinceId)
            this.addressRegionValues.push(this.dataForm.cityId)
            this.addressRegionValues.push(this.dataForm.areaId)
            this.editForm = {
              id:this.dataForm.houseEvaluateDTO.id,
              createId: this.dataForm.createId,
              houseId:this.dataForm.houseEvaluateDTO.houseId,
              slEvaluationPrice: this.dataForm.houseEvaluateDTO.slEvaluationPrice,
              lanhaiEvaluationPrice: this.dataForm.houseEvaluateDTO.lanhaiEvaluationPrice,
              lanhaiRate:this.dataForm.houseEvaluateDTO.lanhaiRate,
              guohouEvaluationPrice: this.dataForm.houseEvaluateDTO.guohouEvaluationPrice,
              guohouRate:this.dataForm.houseEvaluateDTO.guohouRate,
              xiaoyiEvaluationPrice: this.dataForm.houseEvaluateDTO.xiaoyiEvaluationPrice,
              xiaoyiRate:this.dataForm.houseEvaluateDTO.xiaoyiRate,
              yaliancaiEvaluationPrice: this.dataForm.houseEvaluateDTO.yaliancaiEvaluationPrice,
              yaliancaiRate:this.dataForm.houseEvaluateDTO.yaliancaiRate,
              zhongguancunEvaluationPrice: this.dataForm.houseEvaluateDTO.zhongguancunEvaluationPrice,
              zhongguancunRate:this.dataForm.houseEvaluateDTO.zhongguancunRate,
              otherEvaluationPrice: this.dataForm.houseEvaluateDTO.otherEvaluationPrice,
              otherRate:this.dataForm.houseEvaluateDTO.otherRate,
              finalReviewEvaluationPrice:this.dataForm.houseEvaluateDTO.finalReviewEvaluationPrice,
              // remainValue:this.dataForm.remainValue,
              deleted: this.dataForm.houseEvaluateDTO.deleted
            }
            this.regionValues = []
            if( this.dataForm.provinceId!=undefined) {
            this.regionValues.push(this.dataForm.provinceId)
            this.regionValues.push(this.dataForm.cityId)
            this.regionValues.push(this.dataForm.areaId)
            }
            console.log(this.editForm)
            this.dataForm.houseHistries.forEach((item,index) => {
              item.title = this.getValue(index+1)+"押借款机构"
            });
          }
        })
        .catch(() => {
        })
    },
   getValue(val){
      if(val === 1) {
        return "一";
      }
      if(val == 2) {
        return "二";
      }
      if(val == 3) {
        return "三";
      }
    },
    getRegionList() {
      listRegion()
        .then(response => {
          if(response.data != undefined ) {
            this.regionList = response.data
            
            
          }
        })
        .catch(() => {
        })
    },
    houseEvaluation() {
      const loading = this.$loading({
          lock: true,
          text: '评估中',
          spinner: 'el-icon-loading',
          background: 'rgba(192, 192, 192, 0.7)'
        });
      houseEvaluation({address:this.editForm.address,buildArea: this.dataForm.areaTotal,
      projectId: this.projectId,houseId: this.dataForm.id,provinceId: this.regionValues[0], cityId: this.regionValues[1],areaId: this.regionValues[2]})
        .then(response => {
          if(response.data != undefined ) {
               loading.close();
               this.editForm.slEvaluationPrice = response.data
               this.$notify.success({
                title: '成功',
                message: '评估成功'
              })
              let slEvaluationPrice = this.editForm.slEvaluationPrice
              if(this.editForm.lanhaiEvaluationPrice != "" || this.editForm.lanhaiEvaluationPrice != undefined ) {
                  let tb = (this.editForm.lanhaiEvaluationPrice - slEvaluationPrice)/slEvaluationPrice*100;
                // tb = !isNaN(tb) && tb<0?Number(tb.toString().replace(/-/g,'')):tb;
                  this.editForm.lanhaiRate = !isNaN(tb)?tb.toFixed(2):'';
                }
                //国厚
                if(this.editForm.guohouEvaluationPrice != "" || this.editForm.guohouEvaluationPrice  != undefined ) {
                  let tb = (this.editForm.guohouEvaluationPrice - slEvaluationPrice)/slEvaluationPrice*100;
                // tb = !isNaN(tb) && tb<0?Number(tb.toString().replace(/-/g,'')):tb;
                  this.editForm.guohouRate = !isNaN(tb)?tb.toFixed(2):'';
                  
                }
                //小忆
                if(this.editForm.xiaoyiEvaluationPrice != "" || this.editForm.xiaoyiEvaluationPrice != undefined ) {
                  let tb = (this.editForm.xiaoyiEvaluationPrice - slEvaluationPrice)/slEvaluationPrice*100;
                // tb = !isNaN(tb) && tb<0?Number(tb.toString().replace(/-/g,'')):tb;
                  this.editForm.xiaoyiRate = !isNaN(tb)?tb.toFixed(2):'';
                }
                //亚联财
                if(this.editForm.yaliancaiEvaluationPrice != "" || this.editForm.yaliancaiEvaluationPrice != undefined ) {
                  let tb = (this.editForm.yaliancaiEvaluationPrice - slEvaluationPrice)/slEvaluationPrice*100;
                // tb = !isNaN(tb) && tb<0?Number(tb.toString().replace(/-/g,'')):tb;
                  this.editForm.yaliancaiRate = !isNaN(tb)?tb.toFixed(2):'';
                }
                //中关村
                if(this.editForm.zhongguancunEvaluationPrice != "" || this.editForm.zhongguancunEvaluationPrice != undefined ) {
                  let tb = (this.editForm.zhongguancunEvaluationPrice - slEvaluationPrice)/slEvaluationPrice*100;
                // tb = !isNaN(tb) && tb<0?Number(tb.toString().replace(/-/g,'')):tb;
                  this.editForm.zhongguancunRate = !isNaN(tb)?tb.toFixed(2):'';
                }
                //其他
                if(this.editForm.otherEvaluationPrice != "" || this.editForm.otherEvaluationPrice != undefined ) {
                  let tb = (this.editForm.otherEvaluationPrice - slEvaluationPrice)/slEvaluationPrice*100;
                // tb = !isNaN(tb) && tb<0?Number(tb.toString().replace(/-/g,'')):tb;
                  this.editForm.otherRate = !isNaN(tb)?tb.toFixed(2):'';
                }
          }
        })
        .catch(() => {
          loading.close();
        })
    },
     taskSupplementStatus() {
      taskSupplementStatus({projectId:this.projectId,taskId: this.taskId})
        .then(response => {
          if( this.projectStatus < 10 ) {//待审查之后状态才显示
            this.showEvaluation = false
          }
          if( response.data != undefined ) {
            console.log(response.data)
             if( this.projectStatus == 18 && response.data >=10){
               this.showEvaluation = false
            }
            
          }
        })
        .catch(() => {
        })
    },
    createData(){
        if( this.addressRegionValues.length>0){
          this.dataForm.provinceId = this.addressRegionValues[0]
          this.dataForm.cityId = this.addressRegionValues[1]
          this.dataForm.areaId = this.addressRegionValues[2]
        }
      
        if (this.editForm.slEvaluationPrice!=undefined && parseFloat(this.editForm.slEvaluationPrice).toString() == "NaN") {
            this.dataForm.slEvaluationPrice = undefined
        }else{
          this.dataForm.slEvaluationPrice = this.editForm.slEvaluationPrice
        }
        this.dataForm.rate = this.editForm.rate
        this.dataForm.taskId = this.taskId
        this.dataForm.houseEvaluateDTO = this.editForm
        updateHouse(this.dataForm)
            .then(response => {
              this.findByProjectId()
              this.$notify.success({
                title: '成功',
                message: '保存成功'
              })
            })
            .catch(response => {
            })
    },
    clickGet(){ 
       if( this.regionValues === undefined || this.regionValues.length===0 ) {
         this.$message.error("请先选择区域哦")
         return false
       }
       if( this.dataForm.areaTotal == undefined || this.dataForm.areaTotal==0){
         this.$message.info("请填写房产建筑面积")
         return false
       }
       this.houseEvaluation()
    },
    exportData() {

        exportHouse({projectId: this.projectId})
            .then((res) => {
              const content = res.data;
              
              window.open(content.fileUrl)
            })
            .catch(response => {
              console.log(response)
              this.$notify.error({
                title: '失败',
                message: response.data.message
              })
            })
    },
      //利用函数传参达到复用，以减少代码量
      numValid(val){
        //只能输入数字
        // this.editForm[val] = this.editForm[val].replace(/(^\s*)|(\s*$)/g, "");
        const reg = /[^\d.]/g;

        // 只能是数字和小数点，不能是其他输入
        this.editForm[val] = this.editForm[val].replace(reg, "");

        // 保证第一位只能是数字，不能是点
        this.editForm[val] = this.editForm[val].replace(/^\./g, "");
        // 小数只能出现1位
        this.editForm[val] = this.editForm[val]
          .replace(".", "$#$")
          .replace(/\./g, "")
          .replace("$#$", ".");
        // 小数点后面保留2位
        this.editForm[val] = this.editForm[val].replace(
          /^(\-)*(\d+)\.(\d\d).*$/,
          "$1$2.$3"
        );
        // this.editForm[val] =this.editForm[val].replace(
        //   /^(\-)*(\d+)\.(\d\d).*$/,
        //   "$1$2.$3"
        // )
      },
      //利用函数传参达到复用，以减少代码量
      numValiddata(val){
        //只能输入数字
        // this.editForm[val] = this.editForm[val].replace(/(^\s*)|(\s*$)/g, "");
        const reg = /[^\d.]/g;

        // 只能是数字和小数点，不能是其他输入
        this.dataForm[val] = this.dataForm[val].replace(reg, "");

        // 保证第一位只能是数字，不能是点
        this.dataForm[val] = this.dataForm[val].replace(/^\./g, "");
        // 小数只能出现1位
        this.dataForm[val] = this.dataForm[val]
          .replace(".", "$#$")
          .replace(/\./g, "")
          .replace("$#$", ".");
        // 小数点后面保留2位
        this.dataForm[val] = this.dataForm[val].replace(
          /^(\-)*(\d+)\.(\d\d).*$/,
          "$1$2.$3"
        );
      },
      inputChange(value,type) {
        let slEvaluationPrice = this.editForm.slEvaluationPrice;
        
        // (世联评估价-当前输入项值）/世联评估价*100
        if(type == 'slEvaluationPrice'){
         //蓝海
          if(this.editForm.lanhaiEvaluationPrice != "" || this.editForm.lanhaiEvaluationPrice != undefined ) {
            let tb = (this.editForm.lanhaiEvaluationPrice - slEvaluationPrice)/slEvaluationPrice*100;
          // tb = !isNaN(tb) && tb<0?Number(tb.toString().replace(/-/g,'')):tb;
            this.editForm.lanhaiRate = !isNaN(tb)?tb.toFixed(2):'';
          }
          //国厚
          if(this.editForm.guohouEvaluationPrice != "" || this.editForm.guohouEvaluationPrice  != undefined ) {
            let tb = (this.editForm.guohouEvaluationPrice - slEvaluationPrice)/slEvaluationPrice*100;
          // tb = !isNaN(tb) && tb<0?Number(tb.toString().replace(/-/g,'')):tb;
            this.editForm.guohouRate = !isNaN(tb)?tb.toFixed(2):'';
             
          }
          //小忆
          if(this.editForm.xiaoyiEvaluationPrice != "" || this.editForm.xiaoyiEvaluationPrice != undefined ) {
            let tb = (this.editForm.xiaoyiEvaluationPrice - slEvaluationPrice)/slEvaluationPrice*100;
          // tb = !isNaN(tb) && tb<0?Number(tb.toString().replace(/-/g,'')):tb;
            this.editForm.xiaoyiRate = !isNaN(tb)?tb.toFixed(2):'';
          }
          //亚联财
          if(this.editForm.yaliancaiEvaluationPrice != "" || this.editForm.yaliancaiEvaluationPrice != undefined ) {
            let tb = (this.editForm.yaliancaiEvaluationPrice - slEvaluationPrice)/slEvaluationPrice*100;
          // tb = !isNaN(tb) && tb<0?Number(tb.toString().replace(/-/g,'')):tb;
            this.editForm.yaliancaiRate = !isNaN(tb)?tb.toFixed(2):'';
          }
          //中关村
          if(this.editForm.zhongguancunEvaluationPrice != "" || this.editForm.zhongguancunEvaluationPrice != undefined ) {
            let tb = (this.editForm.zhongguancunEvaluationPrice - slEvaluationPrice)/slEvaluationPrice*100;
          // tb = !isNaN(tb) && tb<0?Number(tb.toString().replace(/-/g,'')):tb;
            this.editForm.zhongguancunRate = !isNaN(tb)?tb.toFixed(2):'';
          }
          //其他
          if(this.editForm.otherEvaluationPrice != "" || this.editForm.otherEvaluationPrice != undefined ) {
            let tb = (this.editForm.otherEvaluationPrice - slEvaluationPrice)/slEvaluationPrice*100;
          // tb = !isNaN(tb) && tb<0?Number(tb.toString().replace(/-/g,'')):tb;
            this.editForm.otherRate = !isNaN(tb)?tb.toFixed(2):'';
          }
        }else{
          if(slEvaluationPrice && slEvaluationPrice != ""){
            let tb = (value - slEvaluationPrice)/slEvaluationPrice*100;
            // tb = !isNaN(tb) && tb<0?Number(tb.toString().replace(/-/g,'')):tb;
            this.editForm[type] = !isNaN(tb) && value != ''?tb.toFixed(2):'';
          }
        }
        
        
      }
    }
  }
</script>

<style>

.table_1 .el-input__inner{
  height:52px;
  line-height: 55px;
  border:0px solid;
}
.table_2 .el-input__inner:hover{
  border-color:#C0C4CC;
}
.table_1 .el-input-group__append{
  border:0px solid;
}

.table_1 .box-card{
  margin-top:30px;
  background-color: #f4f4f4;
}
.table_1 .box-card .el-form-item__content{
  width: 400px;
}

.table_1 {
  background-color: #fff;
  width: 100%;
  font-size: 14px;
}
.table_title{
  background-color: #fff;
  border-top: 1px solid #c7c7c7;
  border-right: 1px solid #c7c7c7;
  border-left: 1px solid #c7c7c7;
  width: 100%;
  background-color: #fff;
  text-align: center;
  line-height: 50px;
}
.table_wrap{
  border-collapse: collapse;
  border-spacing: 0px;
  width: 100%;

}

.table_td {
  text-align: center;
  line-height: 50px;
  min-width: 90px;
  border: 1px solid #c7c7c7;
}
.td_color{
  background-color: #f4f4f4;
}

</style>